import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';

Card GCBarChart({List rawBarGroups}) {
    return Card(
      elevation: 0,
      child: Container(
          decoration: BoxDecoration(
          border: new Border.all(color: Color(0xFFE5F3F4), width: 1),
          color: Colors.white, // 底色
          borderRadius: new BorderRadius.circular(8),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          mainAxisAlignment: MainAxisAlignment.start,
          mainAxisSize: MainAxisSize.max,
          children: <Widget>[
            SizedBox(height: 10),
            Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisSize: MainAxisSize.min,
              mainAxisAlignment: MainAxisAlignment.start,
              children: <Widget>[
                const SizedBox(
                  width: 27,
                ),
                const Text(
                  '镀锌钢管',
                  style: TextStyle(color: Color(0xFF5B5B5B), fontSize: 14),
                ),
                Expanded(child: SizedBox()),
                const Text(
                  '上涨指数',
                  style: TextStyle(color: Color(0xFF5B5B5B), fontSize: 8),
                ),
                const SizedBox(width: 66),

                ],
            ),
            Container(
              height: 50,
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.start,
                children: <Widget>[
                  const SizedBox(
                    width: 27,
                  ),
                  Text(
                    '¥2505',
                    style: TextStyle(color: Color(0xFFF75554), fontSize: 36, fontWeight: FontWeight.bold),
                  ),
                  Expanded(child: SizedBox()),
                  Row(
                    children: [
                      Text(
                        '35',
                        style: TextStyle(color: Color(0xFFF75554), fontSize: 24, fontWeight: FontWeight.bold),
                      ),
                      Column(
                        children: [
                          Icon(Icons.arrow_upward, color: Color(0xFFF75554)),
                          SizedBox(height: 20)
                        ],
                      )
                    ],
                  ),
                  const SizedBox(width: 39),

                ],
              ),
            ),
            const SizedBox(
              height: 38,
            ),
            Expanded(
              child: Padding(
                padding: const EdgeInsets.symmetric(horizontal: 30.0),
                child: BarChart(
                  BarChartData(
                    maxY: 20,
                    titlesData: FlTitlesData(
                      show: true,
                      bottomTitles: SideTitles(
                        showTitles: true,
                        getTextStyles: (value) => const TextStyle(
                            color: Color(0x57333333), fontWeight: FontWeight.normal, fontSize: 10),
                        margin: 20,
                        getTitles: (double value) {
                          switch (value.toInt()) {
                            case 0:
                              return '08.28 \n2019';
                            case 1:
                              return '08.28 \n2019';
                            case 2:
                              return '08.28 \n2019';
                            case 3:
                              return '08.28 \n2019';
                            case 4:
                              return '08.28 \n2019';
                            case 5:
                              return '08.28 \n2019';
                            case 6:
                              return '08.28 \n2019';
                            default:
                              return '';
                          }
                        },
                      ),
                      leftTitles: SideTitles(
                        interval: 5,
                        showTitles: true,
                        getTextStyles: (value) => const TextStyle(
                            color: Color(0x57333333), fontWeight: FontWeight.normal, fontSize: 10),
                        margin: 30,
                        reservedSize:20,
                        getTitles: (value) {
                          if (value == 0) {
                            return '';
                          } else if (value == 5) {
                            return '500';
                          } else if (value == 10) {
                            return '1000';
                          } else if (value == 15) {
                            return '1500';
                          } else if (value == 20) {
                            return '2000';
                          } else {
                            return '';
                          }
                        },
                      ),
                    ),
                    borderData: FlBorderData(
                      show: false,
                    ),
                    barGroups: rawBarGroups,
                  ),
                ),
              ),
            ),
            SizedBox(height: 14),
          ],
        ),
      ),
    );

}